{extend name='admin@public/content'}

{block name="content"}
<form autocomplete="off" onsubmit="return false;" action="{:request()->url()}" data-auto="true" method="post" class='form-horizontal layui-form padding-top-20'>

    <div class="form-group">
        <label class="col-sm-2 control-label">案例名称</label>
        <div class='col-sm-8'>
            <input autofocus name="title" value='{$vo.title|default=""}' required="required" title="请输入案例名称" placeholder="请输入案例名称" class="layui-input">
        </div>
    </div>

    <!--{if !empty($members)}-->
    <div class="form-group">
        <label class="col-sm-2 control-label">用户</label>
        <div class='col-sm-8'>
            <select required class="layui-select full-width" name="mid" lay-filter="mid">
                {foreach $members as $member}
                <!--{eq name='$member.id' value='$vo.mid|default=0'}-->
                <option selected="selected" value="{$member.id}">{$member.nickname}</option>
                <!--{else}-->
                <option value="{$member.id}">{$member.nickname}</option>
                <!--{/eq}-->
                {/foreach}
            </select>
        </div>
    </div>
    <!--{/if}-->

    <div class="form-group">
        <label class="col-sm-2 control-label">标签</label>
        <div class='col-sm-8'>
            {assign name="flag_arr" value="$Think.const.FLAG_ARR" /}
            {foreach $flag_arr as $flag_key=>$flag }
            <label class="think-checkbox"><input lay-ignore class="list-check-box" type="checkbox" {in name="flag_key" value="$vo['flag']|default=''"}checked{/in} value="{$flag_key}" name="flag[]"/> {$flag}</label>
            {/foreach}
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label label-required">经典案例</label>
        <div class='col-sm-8'>
            <table class="layui-table background-item margin-none" lay-size="sm" lay-skin="nob">
                <thead>
                <tr>
                    <td>案例图片</td>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td class="text-top">
                        <input type="hidden" name="images" value="{$vo.images|default=''}">
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
    <script>
        $('input[name="images"]').uploadMultipleImage();
    </script>

    <div class="form-group">
        <label class="col-sm-2 control-label label-required">案例描述</label>
        <div class='col-sm-8'>
            <textarea name="desc">{$vo.desc|default=''|htmlspecialchars_decode}</textarea>
        </div>
    </div>

    <div class="hr-line-dashed"></div>

    <div class="col-sm-7 col-sm-offset-2">
        <div class="layui-form-item text-center">
            {if !empty($vo.id)}<input type="hidden" name="id" value="{$vo.id}">{/if}
            <button class="layui-btn" type="submit">保存</button>
            <button class="layui-btn layui-btn-danger" type='button' onclick="window.history.back()">取消</button>
        </div>
    </div>

    <script>
        require(['jquery', 'ckeditor', 'angular'], function () {
            window.form.render();
            window.createEditor('[name="desc"]', {height: 200});
        });
    </script>

    <style>
        .background-item {
            padding: 15px;
            background: #efefef;
        }

        .background-item thead tr {
            background: #e0e0e0
        }
    </style>
</form>
{/block}